In [2]:
using FileIO: load, save
import LibSndFile
using Plots
pyplot();
$ afinfo birdland_original.wav 
File:           birdland_original.wav
File type ID:   WAVE
Num Tracks:     1
----
Data format:     2 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer
                no channel layout.
estimated duration: 12.240317 sec
audio bytes: 2159192
audio packets: 539798
bit rate: 1411200 bits per second
packet size upper bound: 4
maximum packet size: 4
audio data file offset: 44
not optimized
source bit depth: I16
----
In [5]:
sndorg = load("birdland_original.wav")
Out[5]:

SampleBuf display requires javascript

To enable for the whole notebook select "Trust Notebook" from the "File" menu. You can also trust this cell by re-running it. You may also need to re-run `using SampledSignals` if the module is not yet loaded in the Julia kernel, or `SampledSignals.embed_javascript()` if the Julia module is loaded but the javascript isn't initialized.

$ afconvert -f mp4f  -o birdland.mp4
$ afinfo birdland.mp4 
File:           birdland.mp4
File type ID:   mp4f
Num Tracks:     1
----
Data format:     2 ch,  44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
                no channel layout.
estimated duration: 12.240317 sec
audio bytes: 200206
audio packets: 530
bit rate: 130145 bits per second
packet size upper bound: 682
maximum packet size: 682
audio data file offset: 4096
optimized
audio 539798 valid frames + 2112 priming + 810 remainder = 542720
format list:
[ 0] format:      2 ch,  44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Channel layout: Stereo (L R)
----
$ afconvert -f WAVE -d LEI16 birdland.mp4 birdland_aac.wav
$ afinfo birdland_aac.wav 
File:           birdland_aac.wav
File type ID:   WAVE
Num Tracks:     1
----
Data format:     2 ch,  44100 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer
                no channel layout.
estimated duration: 12.240317 sec
audio bytes: 2159192
audio packets: 539798
bit rate: 1411200 bits per second
packet size upper bound: 4
maximum packet size: 4
audio data file offset: 4096
optimized
source bit depth: I16
----
In [7]:
sndaac = load("birdland_aac.wav")
Out[7]:

SampleBuf display requires javascript

To enable for the whole notebook select "Trust Notebook" from the "File" menu. You can also trust this cell by re-running it. You may also need to re-run `using SampledSignals` if the module is not yet loaded in the Julia kernel, or `SampledSignals.embed_javascript()` if the Julia module is loaded but the javascript isn't initialized.

In [18]:
sndmp3 = load("birdland_mp3.wav")
Out[18]:

SampleBuf display requires javascript

To enable for the whole notebook select "Trust Notebook" from the "File" menu. You can also trust this cell by re-running it. You may also need to re-run `using SampledSignals` if the module is not yet loaded in the Julia kernel, or `SampledSignals.embed_javascript()` if the Julia module is loaded but the javascript isn't initialized.

In [14]:
xorg = sndorg.data[:,1];
xaac = sndaac.data[:,1];
fs = sndorg.samplerate;
t = (0 : length(xorg)-1) / fs;
In [17]:
snddif = sndorg - sndaac
Out[17]:

SampleBuf display requires javascript

To enable for the whole notebook select "Trust Notebook" from the "File" menu. You can also trust this cell by re-running it. You may also need to re-run `using SampledSignals` if the module is not yet loaded in the Julia kernel, or `SampledSignals.embed_javascript()` if the Julia module is loaded but the javascript isn't initialized.

In [19]:
sndorg - sndmp3
Out[19]:

SampleBuf display requires javascript

To enable for the whole notebook select "Trust Notebook" from the "File" menu. You can also trust this cell by re-running it. You may also need to re-run `using SampledSignals` if the module is not yet loaded in the Julia kernel, or `SampledSignals.embed_javascript()` if the Julia module is loaded but the javascript isn't initialized.